//
//  ViewController.m
//  TouchExplorer
//
//  Created by student on 16/3/17.
//  Copyright © 2016年 NIIT. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()
@property (weak, nonatomic) IBOutlet UILabel *label1;
@property (weak, nonatomic) IBOutlet UILabel *label2;
@property (weak, nonatomic) IBOutlet UILabel *label3;
@property (weak, nonatomic) IBOutlet UILabel *label4;

@property (weak, nonatomic) IBOutlet UIView *moveView;



@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
}

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(nullable UIEvent *)event
{
   self.label1.text = @"触摸开始";
    self.label2.text = [NSString stringWithFormat:@"数量:%li",touches.count];
    // 得到触摸对象
    UITouch *touch = touches.anyObject;
    // 得到触摸点在self.view中的坐标
    CGPoint p = [touch locationInView:self.view];
    self.label3.text = [NSString stringWithFormat:@"坐标:%@",NSStringFromCGPoint(p)];
    self.label4.text = [NSString stringWithFormat:@"连击次数:%li",touch.tapCount];
}
- (void)touchesMoved:(NSSet<UITouch *> *)touches withEvent:(nullable UIEvent *)event
{
    self.label1.text = @"触摸移动";
}
- (void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(nullable UIEvent *)event
{
    self.label1.text = @"触摸结束";
}



@end
